package com.example.demo.service.impl;/**
 * @author Daog
 * @create 2020 -11 -2020-11-02 23:19
 * @description 功能描述
 */

import com.example.demo.dao.UserDao;
import com.example.demo.service.UserService;
import com.example.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @program: demo_boot
 *
 * @description:
 *
 * @author: Dong
 *
 * @create: 2020-11-02 23:19
 **/
@Service
public class UserServiceImpl2 implements UserService {

    @Autowired
    private UserDao userDao;

    @Override
    public List<User> getUserList() {
        return userDao.getAll();
    }

    @Override
    public void createUser(User user) {
        userDao.save(user);
    }

    @Override
    public User getUser(Long id) {
        return userDao.findOne(id);
    }

    @Override
    public void updateUser(Long id, User user) {
        user.setId(id);
        userDao.update(user);

    }

    @Override
    public void deleatUser(Long id) {
        userDao.delete(id);
    }
}
